Combining Type Classes and Existential Types

نویسنده

  • Konstantin Läufer
چکیده

This paper demonstrates that the novel combination of type classes and existential types adds significant expressive power to a language, requiring only a minor syntactic change. We explore this combination in the context of higher-order functional languages with static typing, parametric polymorphism, algebraic data types, and Hindley-Milner type inference. Since we have examined the underlying type-theoretic issues already, this paper focuses on the practical aspects of our extension. We first examine limitations of existing functional and object-oriented languages. We then give examples to demonstrate how our first-class abstract types with user-defined interfaces address those limitations. Finally, we give an informal description of the translation from our language to a target language without type classes. Our extension equally applies to other languages with similar type systems and is independent of strictness considerations. It has been implemented in the Chalmers Haskell B. system, and all examples from this paper have been developed using this system.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Type Classes with Existential Types

We argue that the novel combination of type classes and existential types in a single language yields significant expressive power. We explore this combination in the context of higher-order functional languages with static typing, parametric polymorphism, algebraic data types, and Hindley-Milner type inference. Adding existential types to an existing functional language that already features t...

متن کامل

A Framework for Extended Algebraic Data Types

Data Types have Existential Types data Stack a = forall s. Stack s -self (a->s->s) -push (s->s) -pop (s->a) -top (s->Bool) -empty push :: a -> Stack a -> Stack a push x (Stack s push’ pop top empty) = Stack (push’ x s) push’ pop top empty pop :: Stack a -> Stack a pop (Stack s push pop’ top empty) = Stack (pop’ s) push pop’ top empty A Framework for Extended Algebraic Data Types – p.6 Abstract ...

متن کامل

JavaGI : Generalized Interfaces for Java

JavaGI is an experimental language that extends Java 1.5 by generalizing the interface concept to incorporate the essential features of Haskell’s type classes. In particular, generalized interfaces cater for retroactive and constrained interface implementations, binary methods, static methods in interfaces, default implementations for interface methods, interfaces over families of types, and ex...

متن کامل

A Type System for Computer Algebra

This paper presents a type system for support of subtypes, parameterized types with sharing and categoriesin a computeralgebra environment.By modelingrepresentationof instances in terms of existential types, we obtain a simpliied model, and build a basis for deening subtyping among algebraic domains. The inheritance at category level has been formalized; this allows the automatic inference of t...

متن کامل

Efficient TBox Subsumption Checking in Combinations of EL and (fragments of) FL0

We study possibilities of combining (fragments) of the lightweight description logics FL0 and EL, and identify classes of subsumption problems in a combination of EL and Horn-FL0, which can be checked in PSPACE resp. PTIME. Since FL0 allows universal role restrictions and EL allows existential role restrictions, we thus have a framework where subsumption between expressions including both types...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994